local ShareLayer = {}

ShareLayer.m_PanelShare = nil
 
function ShareLayer.show( widget )
    print("============ShareLayer.show===============")
    ShareLayer:init( widget )
    
end

function ShareLayer:closeWindow() 
    self.m_PanelShare:setLocalZOrder(-1)
    self.m_PanelShare:setVisible(false)
end


function ShareLayer:init( widget )
    print("============ShareLayer:init============")
    
    self.m_PanelShare = ccui.Helper:seekWidgetByName(widget.m_Json,"PanelShare")
    self.m_PanelShare:setPositionX(0)
    self.m_PanelShare:setPositionY(0) 
    self.m_PanelShare:setVisible(true)
    self.m_PanelShare:setLocalZOrder(5)
    
    self.m_BtnBack = ccui.Helper:seekWidgetByName(self.m_PanelShare,"BtnBack")
    self.m_BtnBack:setTouchEnabled(true)
    self.m_BtnBack:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
 
    self.m_BtnSound = ccui.Helper:seekWidgetByName(self.m_PanelShare,"BtnSound")
    self.m_BtnSound:setTouchEnabled(true)
    self.m_BtnSound:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
  
end


function ShareLayer:onMenutClick(sender,eventType)
    if eventType == ccui.TouchEventType.ended then
        if sender == self.m_BtnSound then     
            print "=========ShareLayer:onMenutClick m_BtnSound======================="
        elseif sender == self.m_BtnBack then     
            print "=========ShareLayer:onMenutClick m_BtnBack======================="
            self:closeWindow()
        end
    end
end
 
return ShareLayer